# class Car:
#     wheels=4 #类属性
#     def drive(self):
#         print("Car is driving...")
#
#
# car = Car()
# print(car.wheels)
# car.drive()
#
# Car.wheels=3
#
#
# print(Car.wheels)
# print(car.wheels)
#
# car.wheels=4
#
# # 类属性只能通过类来修改
# print(Car.wheels)
# print(car.wheels)

# class Car:
#
#     def drive(self):
#         #报错
#         self.wheels=4 #类属性
#         print("Car is driving...")

#
# car = Car()
# car.drive()#如果没有这一句，下面两个代码都报错
#
# print(car.wheels)#这个可以用
# print(Car.wheels)
# car.color='red'#动态添加属性
# print(car.color)


# class Car:
#     speed =10
#     def drive(self,speed):
#         #报错0
#         self.wheels=4 #类属性
#         print(f"Car is driving...{speed}")
#
#
# car=Car()
# car.drive(100)


class Car:
    speed =10
    wheels = 3
    @classmethod
    def drive(cls,speed):
        #报错0
        cls.wheels=4 #类属性
        print(cls.wheels)
        print(f"Car is driving...{speed}")

    @staticmethod
    def stop(cls):
        print("Stop")
car=Car()
car.drive(10000)

